<template>
  <div class="info-box-container" :class="{ 'info-box--border': props.border }">
    <div class="header-container">
      <div class="header__title">{{ props.title }}</div>
      <div class="header__action" v-show="$slots.action">
        <slot name="action"></slot>
      </div>
    </div>
    <div class="body-container">
      <slot></slot>
    </div>
  </div>
</template>

<script setup>
defineOptions({
  inheritAttrs: false
});

const props = defineProps({
  title: String,
  border: { type: Boolean, default: true }
});
</script>

<style lang="scss" scoped>
.info-box-container {
  width: 100%;
  height: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 4px;
  background-color: var(--bg-color);

  &.info-box--border {
    border: 1px solid var(--border-color);
  }

  .header-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
    padding: 4px 0;

    .header__title {
      font-size: 12px;
      font-weight: 500;
    }
  }

  .body-container {
    width: 100%;
    height: auto;
    color: var(--base-text-color);
    font-size: 2em;
    font-weight: 500;
  }
}
</style>
